package com.pandacc.common.analyzer;


public class ChineseAnalyzerTest {
    private static int PER_TIME_READ_LEN = 1024;   //每次读入文件流长度

    /*private ChineseAnalyzerTest() {}

    public static void printTerms(Analyzer analyzer, String content){
        try{
            TokenStream ts = analyzer.tokenStream("content",
                    new StringReader(content));
            CharTermAttribute term = ts.addAttribute(CharTermAttribute.class);
            ts.reset();

            StringBuffer buf = new StringBuffer();
            while (ts.incrementToken()) {
                buf.append(term.toString());
                buf.append(" ");
            }

            System.out.println(buf.toString());

            System.out.println(analyzer.getClass().getName() + " done\n");
        }catch (IOException ex){
            System.out.println("Segment word fail. " + ex.getMessage());
        }
    }

    public static void main(String[] args){
        if (0 == args.length){
            System.err.println("No Inputing param");
            System.exit(1);
        }

        try {
        	System.out.println(args[0]);
            FileInputStream in = new FileInputStream(new File(args[0]));
            byte[] perRead = new byte[PER_TIME_READ_LEN];

            String strContent = " ";
            int rst = in.read(perRead, 0, PER_TIME_READ_LEN);
            while (-1 != rst){
                strContent = strContent.concat(new String(perRead));
                rst = in.read(perRead, 0, PER_TIME_READ_LEN);
            }

            printTerms(new CJKAnalyzer(), strContent);
            printTerms(new SimpleAnalyzer(), strContent);
            printTerms(new StandardAnalyzer(), strContent);
//            printTerms(new ComplexAnalyzer(), strContent);
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }*/
}
